package cn.middle.edge.portal;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.middle.common.result.Page;

import cn.middle.edge.entity.HairDown;
import cn.middle.edge.service.HairDownService;

/**
 * 下发列表
 * @author KING
 *
 */
@Controller
@RequestMapping("/hairDown")
public class HairDownController {
	
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	private final static String PREFIX = "edge/hairDown/";
	
	@Autowired
	private HairDownService hairDownService;
	
	@GetMapping("/list")
	public String list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
			@RequestParam(value = "limit", defaultValue = "10") Integer limit, String serviceId, String interfaceName,
			 String messageId, String keyword, ModelMap modelMap) {
		logger.info("queryParam  serviceId={}, messageId={}, interfaceName={}, keyword={}",serviceId,messageId,interfaceName,keyword);
		Page<HairDown> hairDowns = this.hairDownService.listConditions(pageNum, limit, messageId, interfaceName, serviceId, keyword);
		modelMap.put("serviceId", serviceId);
		modelMap.put("interfaceName", interfaceName);
		modelMap.put("messageId", messageId);
		modelMap.put("keyword", keyword);
		modelMap.put("pageInfo", hairDowns);
		return PREFIX + "list";
	}

}
